<!DOCTYPE html>
<html>
<head>
    <title>新青年宠物店管理员后台</title>
    <style>
        /* 头部样式 */
        header {
            background-color: #333;
            color: white;
            padding: 15px 20px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        header h1 {
            margin: 0;
            font-size: 24px;
        }

        /* 侧边栏样式 */
        .sidebar {
            width: 250px;
            background-color: #333;
            color: white;
            position: fixed;
            height: 100%;
            overflow: auto;
        }

        .sidebar a {
            display: block;
            color: white;
            text-decoration: none;
            padding: 16px;
            border-radius: 3px;
            transition: background-color 0.3s;
        }

        .sidebar a.active, .sidebar a:hover {
            background-color: #555;
        }

        /* 主体样式 */
        main {
            margin-left: 250px; /* 同侧边栏宽度一致 */
            padding: 20px;
        }

        iframe {
            width: 100%;
            height: calc(100vh - 100px);
            border: none;
        }

        /* 表格样式 */
        #userTable {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

        #userTable th, #userTable td {
            padding: 15px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }

        #userTable thead th {
            background-color: #f2f2f2;
            font-weight: bold;
        }

        #userTable tr:nth-child(even) {
            background-color: #f9f9f9;
        }

        #userTable tr:hover {
            background-color: #e0e0e0;
        }

        /* 按钮样式 */
        .editButton, .modifyButton {
            margin-right: 5px;
            padding: 5px 10px;
            cursor: pointer;
            border: none;
            border-radius: 3px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            transition: background-color 0.3s, box-shadow 0.3s;
        }

        .editButton {
            background-color: #4CAF50; /* Green */
            color: white;
        }

        .modifyButton {
            background-color: #FF9800; /* Orange */
            color: white;
        }

        .editButton:hover, .modifyButton:hover {
            background-color: #45a049;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        }
    </style>
</head>
<body>

<header>
    <h1>新青年宠物店管理员后台</h1>
</header>
<div class="container">
    <div class="sidebar">
        <a href="#customer-management" class="tab-link active">客户管理</a>
        <a href="#appointment-info" class="tab-link">预约信息</a>
        <a href="#pet-info" class="tab-link">宠物信息</a>
    </div>
    <main>
        <iframe id="content-frame" name="content-frame" th:src="@{__${contentSrc}__}"></iframe>
    </main>
</div>
<script>
    document.addEventListener('DOMContentLoaded', function() {
        const tabLinks = document.querySelectorAll('.tab-link');

        // 初始状态设置第一个为激活状态
        tabLinks[0].classList.add('active');

        // 监听链接的点击事件
        tabLinks.forEach(link => {
            link.addEventListener('click', function(event) {
                event.preventDefault();

                // 移除所有链接的激活类
                tabLinks.forEach(tab => tab.classList.remove('active'));

                // 将点击的链接设置为激活状态
                this.classList.add('active');

                // 设置iframe的src属性
                const frame = document.getElementById('content-frame');
                if (this.href.includes('customer-management')) {
                    frame.src = '/useradmin';
                } else if (this.href.includes('appointment-info')) {
                    frame.src = '/subadmin';
                }else if (this.href.includes('pet-info')) {
                    frame.src = '/Petadmin';
                }
            });
        });
    });
</script>
</body>
</html>
